package per.turtle.system.entity;

import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.OrderBy;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.ToString;
import per.turtle.common.core.annotation.MaxSizeWithCharset;
import per.turtle.common.core.web.entity.BaseEntity;

import javax.validation.constraints.*;

/**
 * @author turtle
 */
@ApiModel(value = "SysDictData", description = "字典数据")
@Data
@EqualsAndHashCode(callSuper = true)
@TableName("sys_dict_data")
@ToString
public class SysDictData extends BaseEntity {

    private static final long serialVersionUID = 1L;

    @ApiModelProperty("字典编码")
    @TableId(type = IdType.AUTO)
    private Long dictCode;

    @ApiModelProperty("显示顺序")
    @Max(value = 9999, message = "显示顺序取值范围在4位数以内")
    @Min(value = 1, message = "显示顺序取值需大于0")
    @NotNull(message = "显示顺序不能为空")
    @OrderBy(asc = true)
    private Integer orderNum;

    @ApiModelProperty("字典标签")
    @NotBlank(message = "字典标签不能为空")
    @MaxSizeWithCharset(max = 63, message = "字典标签超出限制长度！")
    private String dictLabel;

    @ApiModelProperty("字典键值")
    @NotBlank(message = "字典键值不能为空")
    @MaxSizeWithCharset(max = 63, message = "字典键值超出限制长度！")
    private String dictValue;

    @ApiModelProperty("字典类型")
    @NotBlank(message = "字典类型不能为空")
    @Pattern(regexp = "[\\w]+", message = "字典类型仅支持输入字母，数字和下划线")
    @MaxSizeWithCharset(max = 63, message = "字典类型超出限制长度！")
    private String dictType;

    @ApiModelProperty("是否默认（1：是；0：否）")
    private String isDefault;

    @ApiModelProperty("是否停用（1：是；0：否）")
    private Boolean isDisabled;

    @ApiModelProperty("备注")
    private String remark;

}
